package com.zhouxiaoge.jenkins.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author 周明阳
 * @date 2019/1/21 09:28
 */

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    /**
     * swagger2的配置文件，这里可以配置swagger2的一些基本的内容，比如扫描的包等等
     *
     * @return 返回Docket
     */
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(
                new ApiInfoBuilder()
                        .title("前端测试页面")
                        .contact(new Contact("sinosoft", "http://www.baidu.com", ""))
                        .version("V1.0")
                        .description("API").build())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.zhouxiaoge"))
                .paths(PathSelectors.any()).build();
    }
}
